<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>代扣记录</title>
    {include file="include/top"}
    <style>
        .fox-items {
            position: fixed;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            /*background: rgba(0,0,0,.45);*/
            z-index: 999;
        }

        .fox-focus {
            position: fixed;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            background: rgba(0, 0, 0, .45);
            z-index: 999;
        }

        .fox-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 450px;
            border-radius: 12px;
            background: #fff;
            box-sizing: border-box;
            padding: 15px;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-inline">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="title" placeholder="请填入..." autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                </button>
            </div>
        </div>
        <div class="layui-card-header layuiadmin-card-header-auto">
            <button type="button" class="layui-btn" id="test-upload-type1" data-imgid="addfood"><i
                    class="layui-icon"></i>添加
            </button>
        </div>
        <table class="layui-table"
               lay-data="{height:0, url:'/finance/yeepayIncome', page:true, id:'idTest',toolbar: '#toolbarDemo'}"
               lay-filter="demo">
            <thead>
            <tr>
                <!--                <th lay-data="{field:'id',  sort: true, fixed: true,width:80,checkbox:true}">ID</th>-->
                <th lay-data="{field:'id',  sort: true, fixed: true,width:80}">ID</th>
                <th lay-data="{field:'orderNo'}">结算单号</th>
                <th lay-data="{field:'yeepayNo'}">代扣单号</th>
                <th lay-data="{field:'amount'}">金额</th>
                <th lay-data="{field:'divide_no'}">提现账号</th>
                <th lay-data="{field:'over_time'}">结算时间</th>
                <!--                <th lay-data="{field:'mobile'}">联系电话</th>-->
                <!--                <th lay-data="{field:'amount'}">余额</th>-->
                <th lay-data="{field:'status',templet:function(d){
                    if(d.status==1)
                        return '已结算';
                    else if(d.status == -1)
                        return '失败';
                    else if(d.status == 2)
                        return '已分账';
                    else
                        return '申请成功';
                    }
                }
                ">状态
                </th>
<!--                <th lay-data="{fixed: 'right',  align:'center', toolbar: '#barDemo',width:80}"></th>-->
            </tr>
            </thead>
        </table>
        <script type="text/html" id="toolbarDemo">
        </script>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="more">操作<i
                    class="layui-icon layui-icon-down"></i></a>
        </script>
    </div>
</div>
</body>
{include file="include/js"}
<script>
    layui.config({
        base: '/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'contlist', 'table', 'dropdown', 'form'], function () {
        let $ = layui.$,
            table = layui.table,
            dropdown = layui.dropdown,
            form = layui.form,
            id = ""
        table.on('tool(demo)', function (obj) {
            let that = this,
                data = obj.data;
            if (obj.event === 'more') {
                dropdown.render({
                    elem: that,
                    show: true,
                    data: [
                        {title: '分账', id: 'edit'},
                        // {title: '删除', id: 'delete'},
                    ],
                    click: function (obj) {
                        if (obj.id === 'edit') {
                            id = data.id
                            layer.open({
                                type: 2
                                ,title: '开始分账'
                                ,content: 'rechargeAccount?id='+id
                                ,btn: ['确定', '取消']
                                ,area: ['80%', '80%']
                                ,yes: function(index, layero){
                                    layer.confirm('是否确定操作?', {icon: 3, title:'提示'}, function(index){
                                        //do something
                                        var $data={};
                                        var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags");
                                        console.log(othis)
                                        $data.account = othis.find('select[name="account"]').val()
                                        $data.amount = othis.find('input[name="money"]').val()
                                        $.post("yeepayRecharge?id="+id,$data,function (re) {
                                            layer.msg(re.msg);
                                            if(re.code == 0){
                                                setTimeout(function () {
                                                    location.reload();
                                                },2000);
                                            }
                                        },'json');
                                        layer.close(index);
                                    });
                                }
                            });
                        }
                    }
                })
            }
        })

        // $(function (){

        // })
    });

</script>
</html>
